home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / libraries / patchlibv3.lha / patchlibrary / includes / patch.i < prev    next >
Text File  |  1994-05-04  |  5KB  |  134 lines

  1.     IFND LIBRARIES_PATCH_I
  2. LIBRARIES_PATCH_I SET 1
  3. **
  4. **    Filename:    libraries/patch.i
  5. **    Release:    3.0
  6. **    Date:        04.05.94
  7. **
  8. **    (C) Copyright 1993/94 Stefan Fuchs
  9. **    All rights reserved
  10. **
  11. **      definition of patch.library public structures, returncodes and macros
  12.  
  13.  
  14.     IFND EXEC_TYPES_I
  15.     include "exec/types.i"
  16.     ENDC
  17.  
  18.     IFND EXEC_LISTS_I
  19.     include "exec/lists.i"
  20.     ENDC
  21.  
  22.     IFND EXEC_LIBRARIES_I
  23.     include "exec/libraries.i"
  24.     ENDC
  25.  
  26.     IFND EXEC_SEMAPHORES_I
  27.     include "exec/semaphores.i"
  28.     ENDC
  29.  
  30. ;-------------------------------------------------------------------------
  31. ;Structure required to install new patches via patch.library/InstallPatch()
  32.  
  33.  STRUCTURE NewPatch,0            ;this structure is OBSOLETE from V2 on
  34.     APTR    NPAT_NewCode        ;pointer to the patch code to be installed
  35.     ULONG    NPAT_NewCodeSize    ;optional length of NPAT_NewCode in bytes
  36.     APTR    NPAT_LibraryName    ;pointer to the LibraryName
  37.     UWORD    NPAT_LibVersion        ;version of Library to open
  38.     WORD    NPAT_LVO        ;LVO of function to patch
  39.     WORD    NPAT_Priority        ;Priority (-127...+126) of the patch
  40.     UWORD    NPAT_Flags        ;currently none defined (keep zero)
  41.     APTR    NPAT_PatchName        ;optional pointer to an IDString
  42.     LONG    NPAT_Result2        ;optional pointer to longword for Result2
  43.  
  44.  LABEL NPAT_SIZEOF
  45.  
  46. ;-------------------------------------------------------------------------
  47. ;ErrorCodes:
  48. PATERR_Ok        equ    0    ;Everything Ok
  49. PATERR_PatchInUse    equ    1    ;Patch Usecount <> 0
  50. PATERR_InvalidHandle    equ    2    ;Pointer to patch is not (no longer) valid
  51. PATERR_OutOfMem        equ    3    ;Out of memory
  52. PATERR_OpenLib        equ    4    ;Failed to open requested library
  53. PATERR_FuncNotStd    equ    5    ;Function to patch is not in the standard format
  54. PATERR_PatchInstalled    equ    6    ;Can't remove patch because another program has
  55.                     ;installed a non-patch.library patch later
  56. PATERR_InvalidTags    equ    7    ;There was an error in the combination of the specified Tags
  57. PATERR_OpenDev        equ    8    ;Failed to open requested device
  58. PATERR_NoTaskList    equ    9    ;PATT_AddTask... or PATT_RemTask... was specified for a patch,
  59.                     ;which had no PATT_CreateTaskList set
  60. PATERR_TaskListExists    equ    10    ;PATT_CreateTaskList was specified, but there already exists a TaskList
  61. PATERR_InvalidTaskList    equ    11    ;PATT_CreateTaskList was specified with a wrong parameter
  62.  
  63. ;-------------------------------------------------------------------------
  64. PATCHNAME    MACRO
  65.     dc.b "patch.library",0
  66.     ENDM
  67.  
  68. ;---------------------------------------------------------------
  69. ;--- FALLBACK - Call this macro instead of a 'rts' instruction
  70. ;--- in your patchcode, if you want to return to the original
  71. ;--- library code
  72. ;---------------------------------------------------------------
  73. FALLBACK    MACRO
  74.     move.l (sp),-(sp)
  75.     clr.l 4(sp)
  76.     rts
  77.  
  78.     ENDM
  79.  
  80. ;----------------------------------------------------------------------------
  81. ;----------------------------------------------------------------------------
  82. ;The following structures are not needed by normal patch.library applications
  83. ;----------------------------------------------------------------------------
  84. ;----------------------------------------------------------------------------
  85.     STRUCTURE PatchBase,LIB_SIZE
  86.     UBYTE PB_Flags                ;no public flags defined
  87.     UBYTE PB_reserved1
  88.     ULONG PB_private1
  89.  
  90.     STRUCT    PB_Semaphore,SS_SIZE        ;Semaphore to protect MasterPatchList
  91.     STRUCT    PB_MasterPatchHeader,LH_SIZE    ;Listheader structure for MasterPatch structures
  92.  
  93.     ;...
  94.  
  95. ;-------------------------------------------------------------------------
  96. ; Before accessing this structure, make sure MPS_TYPE is PS_TYPE_MASTER
  97.  
  98.  STRUCTURE MasterPatch,0    ;This structure is READONLY
  99.     APTR    MPS_SUCC    ;Pointer to next (successor)
  100.     APTR    MPS_PRED    ;Pointer to previous (predecessor)
  101.     UBYTE    MPS_TYPE    ;MUST be PS_TYPE_MASTER
  102.     BYTE    MPS_PRI        ;Priority, for sorting
  103.     APTR    MPS_NAME    ;may contain a pointer to the name of the patched library
  104.     UWORD    MPS_Flags            ;no public flags defined
  105.     STRUCT    MPS_PatchHeader,MLH_SIZE    ;Listheader Structure for Patch structures
  106.     APTR    MPS_PatchedLibraryBase        ;Pointer to patched Library
  107.     UWORD    MPS_PatchedLVO            ;Library Vektor Offset in patched Library
  108.  
  109.     ;...
  110.  
  111. ;--------------------------------------------------------------------------
  112. ; Before accessing this structure, make sure PS_TYPE is either PS_TYPE_USER or PS_TYPE_SYSTEM
  113. ; Make sure your program can handle lists, that do not contain any nodes of
  114. ; PS_TYPE_USER or PS_TYPE_SYSTEM
  115.  
  116.  STRUCTURE Patch,0        ;This structure is READONLY
  117.     APTR    PS_SUCC        ;Pointer to next (successor)
  118.     APTR    PS_PRED        ;Pointer to previous (predecessor)
  119.     UBYTE    PS_TYPE        ;MUST be PS_TYPE_USER or PS_TYPE_SYSTEM
  120.     BYTE    PS_PRI        ;Priority, for sorting
  121.     APTR    PS_NAME        ;may contain a pointer to the name of the patch
  122.     UWORD    PS_Flags    ;no public flags defined
  123.  
  124.     ;...
  125.  
  126. ;-------------------------------------------------------------------------
  127. ;Public types for patch and masterpatch structures:
  128. PS_TYPE_MASTER    = 1    ;node is MasterPatch structure
  129. PS_TYPE_USER    = 2    ;node was installed by an Application using the library interface
  130. PS_TYPE_SYSTEM    = 3    ;node was installed by a special patch.library Systemsoftware (not yet implemented)
  131.  
  132.  
  133.     ENDC    ;LIBRARIES_PATCH_I
  134.